// part1:C15:15.26:Quote.h
// class Quote and print_total method.
// debug function.
#ifndef QUOTE_H__
#define QUOTE_H__
#include <iosteam>
class Quote
{
public:
    Quote() = default;
    Quote(const std::string &book, double sales_price):
      bookNo(book), price(sales_price){}
    std::string isbn() const { return bookNo; }

    virtual double net_price(std::size_t n) const
    {
        return n * price;
    }

    virtual void debug()
    {
        std::cout << "bookNo = " << bookNo << " price = " <<
          price << std::endl;
    }
    virtual ~Quote()
    {
        cout << "Quote destructor is running" << endl;
    }

    friend ostream &operator<<(ostream&, Quote&);
private:
    std::string bookNo;
protected:
    double price = 0.0;
};

double print_total(ostream &os, const Quote &item, size_t n)
{
    double ret = item.net_price(n);
    os << "ISBN: " << item.isbn() << " # sold: " << n <<
      " total due: " << ret << std::endl;
    return ret;
}

ostream& operator<<(ostream& os, Quote& e)
{
    os << "\tUsing operator << (ostream&, Quote&);" << endl;
    return os;
}
#endif
